/*
 * Camera.h
 *
 *  Created on: 2009/01/20
 *      Author: JP10161
 */

#ifndef CAMERA_H_
#define CAMERA_H_

#include "core/Vector2D.h"
#include "core/Vector3D.h"
#include "core/ISmartPtr.h"
#include "sqplus/sqplus.h"
using namespace SqPlus;


class Camera : public ISmartPtr<Camera>
{
public:
	static const Vector3D _DEFAULT_EYE;
	static const Vector3D _DEFAULT_LOOKAT;
	static const Vector3D _DEFAULT_UP;

	static const float _DEFAULT_FIELD_OF_VIEW;
	static const float _DEFAULT_NEAR_CLIP;
	static const float _DEFAULT_FAR_CLIP;

public:
	Camera(Vector3D eye = _DEFAULT_EYE, Vector3D lookat = _DEFAULT_LOOKAT, Vector3D up = _DEFAULT_UP);
	virtual ~Camera();

public:
	inline const Vector3D& getEye() const { return mEye; }
	inline void setEye(const Vector3D& p) { mEye = p; }

	inline const Vector3D& getLookat() const { return mLookat; }
	inline void setLookat(const Vector3D& p) { mLookat = p; }

	inline const Vector3D& getUp() const { return mUp; }
	inline void setUp(const Vector3D& p ) { mUp = p; }

	inline const float getAspect() const { return mAspect; }
	inline void setAspect(const float aspect) { mAspect = aspect; }

	inline const float getFov() const { return mFov; }
	inline void setFov(const float fov) { mFov = fov; }

	inline const float getNearClip() const { return mNearClip; }
	inline void setNearClip(const float nearClip) { mNearClip = nearClip; }

	inline const float getFarClip() const { return mFarClip; }
	inline void setFarClip(const float farClip) { mFarClip = farClip; }

	inline const void setPerspective(const float aspect, const float fov, const float nearClip, const float farClip)
	{
		mAspect = aspect;
		mFov = fov;
		mNearClip = nearClip;
		mFarClip = farClip;
	}

	inline const Vector3D& getPosition() const { return mPosition; }
	void setPosition(const Vector3D& pos);

	inline const float getRotation() const { return mRotation; }
	inline void setRotation(const float r) { mRotation = r; }

	inline const bool getOrthogonal() const { return mOrthogonal; }
	inline void setOrthogonal(const bool ortho) { mOrthogonal = ortho; }

	inline const Vector2D& getScale() const { return mScale; }
	inline void setScale(const Vector2D& scale) { mScale = scale; }

private:
	Vector3D	mEye;
	Vector3D	mLookat;
	Vector3D	mUp;

	float		mAspect;
	float		mFov;
	float		mNearClip;
	float		mFarClip;

	Vector3D	mPosition;
	float		mRotation;

	Vector2D	mScale;

	bool		mOrthogonal;
};

//must be declared here
DECLARE_INSTANCE_TYPE(Camera)

#endif /* CAMERA_H_ */
